<%-- 
    Document   : testarSub
    Created on : 2011-nov-30, 14:47:51
    Author     : sa11


    TODO: lägg till så sidan som ska visas i "huvudfältet" skickas med som en get som man sedan hämtar ut och sätter
    includen till..... går detta? kanske kan använda frames annars....
--%>

<%@page import="Beans.LoggedInBean"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
<html>
    <head>
        <%-- <% if(request.getParameter("displayPage") == null){ response.sendRedirect("testarSub.jsp?displayPage=BloggInlagg");} %> --%>
        <title>JSP Page</title>
    </head>
    <body>
        <h1>Mattis, Sami och fichens blogg</h1>
        <%--
        <jsp:include page = "tstGreet.html"/>
        
        <table>
            <tr>
                <td>
                    <jsp:include page = "tstGreet.html"/>
                </td>
            </tr>
            <tr>
                <td>
                    <jsp:include page = "ballot.html"/>
                </td>
            </tr>
        </table>
        --%>
        <table border='1'>
            <%-- <tr>
                <td>
                    <jsp:include page="Initer" flush="true"></jsp:include>

                </td>

            </tr>
            --%>
            <tr>
                <%--
                <td>
                   
                    <iframe src="${param.displayPage}" id ="mainField" height = "500" width = "750"><p>not supported</p></iframe>
                    
                </td>
                <%-- --%>
                <td>
                    <jsp:useBean id="loggedPerson" class="Beans.LoggedInBean" scope="application" />

                    <c:if test = "${pageContext.request.method == 'POST'}">
                        <%!  %>
                        ${loggedPerson.setusername(param.username)}
                        ${loggedPerson.setPassword(param.passwd)}
                        ${loggedPerson.getAliasFromDBT(param.username)}

                    </c:if>
                    <%if (loggedPerson.getusername() == null || loggedPerson.getusername() == "" || loggedPerson.getAlias() == null) {%> <%-- --%>
                    <jsp:include page="logIn.jsp" />
                    <a href = "registerUser.jsp">register new user</a>

                    <%} else {%>
                    alias: ${loggedPerson.getAlias()}

                    <a href = "ProcessLogOut">logout</a>
                    <%-- <a href = "TakeInBlogg">new blogg</a> <%-- --%>
                    <form action= "TakeInBlogg">
                        <input type = "submit" name = "submit" value = "blogg" />
                    </form>
                    
                    <%}%>
                    ${loggedPerson.saveBean(loggedPerson)}




                </td></tr>
            <tr>
                <td>             
                    <p><jsp:include page="BloggInlagg" flush="true"></jsp:include>"</p><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
                    </td>
                    <td><jsp:include page = "RightPage1" flush="true"></jsp:include></td>
            </tr>
        </table>

    </body>
</html>
